v0.7

This page describes a quick-and-dirty SSHD setup on Windows XP using Cygwin. This is not official installation instructions for Cygwin, nor does it necessarily result in an enterprise quality setup. Just the minimum needed to get going.

Prepare
  1. You must be logged in as a user with Administrator privileges
  2. Create folder C:\cygwin
Download and Install Cygwin (1.7.6) OpenSSH
  1. Go To http://www.cygwin.com/ and click "Install or update Cygwin now!"
  2. Save setup.exe to your desktop
  3. Run setup.exe
    1. Install from Internet (default)
    2. Install Root Directory: C:\cygwin (default)
    3. Install for All Users (default)
    4. Local package directory: C:\cygwin\packages
    5. Set proxy if needed
    6. Select a download site
    7. Select Packages
      1. Search for openssh. It is under the Net category.
      2. Locate openssh and click "Skip" to select it.
      3. Click Next. It will list unmet dependencies. Leave "Select required packages" checked and click Next
      4. The packages will install
      5. Click Finish
  4. You now have a basic cygwin installation that includes ssh/sshd
Configure and start sshd
  1. Make sure that your Windows system has user accounts created for all user that you want to be able to access the system via SSH. It seems to work best if those users have passwords set.
  2. Double Click on Cygwin icon. This starts a cygwin terminal
  3. In my case I did not have a password associated with my account and sshd was not allowing me to authenticate until I set a password. So I did this:
    1. $ passwd yourusername
    2. enter new password
    3. This also sets the password on your Windows account
  4. Run: ssh-host-config, answer "yes" to all questions (take the defaults)
  5. Start sshd: 'net start sshd'
Set Window's Path

Make sure your Window's Path has the Cygwin bin directory in it (C:\cygwin\bin). You can do this via the System Information control panel. Click Advanced, then Environment Variables and modify the value of the Path environment variable.

Test
  1. From another system ssh into your Window's box using the username and password for your Windows account:
    1. ssh -l username windowsbox.com
    2. If this works your basic Windows SSHD setup is complete
Using with GlassFish 3.1
  1. To use immediately use the system with GF with SSH password authentication see option 3 in:  3.1SSHAuthentication
  2. If you want to use key authentication then see the information here: 3.1SSH Setup

References
----------
How to install OpenSSH sshd server on Windows
http://chinese-watercolor.com/LRP/printsrv/cygwin-sshd.html

In combination with http://wikis.sun.com/display/GlassFish/GlassFishProvisioning I succeeded to deploy my app on GF 3.1 (build 35) using SSH on Windows. However, our hosts are part of an active directory environment (Windows domain). I did not manage to install Cygwin properly using my domain account. I was forced to create a local account on each host machine. I used the local account to install Cygwin and used the --sshuser argument to provide the local user account. Then it worked just fine.

Posted by rrockx at Jan 10, 2011 04:21